package com.benmei.ntlive.dto.ntmsg.cons;

/**
 * Created by Peter on 2017/8/21.
 */
public enum Action {
    CREATE_SESSION(1, "createSession"),

    TO_PAGE(2, "toPage"),

    DRAWING(3, "drawing"),// 涂鸦，绘画

    ERASER(4, "eraser"),// 涂鸦，橡皮檫

    HEART_BEAT(5, "heartBeat"),// 心跳检测包

    LOGOUT(6, "logout");// 通知客户端退出程序，断开连接

    private final int value;

    private final String name;


    Action(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public static boolean isValidateAction(String name) {
        boolean result = false;
        for (Action action : Action.values()) {
            if (action.name.equalsIgnoreCase(name)) {
                result = true;
                break;
            }
        }
        return result;
    }


}
